<template>
  <Backdrop>
    <div class="popup-content">
      <header>
        <slot name="header"></slot>
        <a
          class="btn"
          @click="changeShowDialog">
          <i class="iconfont">×</i>
        </a>
      </header>
      <main>
        <slot name="main"></slot>
      </main>
      <footer>
        <slot name="footer"></slot>
      </footer>
    </div>
  </Backdrop>
</template>

<script setup lang="ts">
import Backdrop from '@/components/backdrop/index.vue'
const props = defineProps({
  changeShowDialog: Function
})
const changeShowDialog = () => {
  props.changeShowDialog && props.changeShowDialog()
}
</script>

<style lang="less" scoped>
.popup-content {
  width: 660px;
  background-color: #fff;
  header {
    position: relative;
    height: 32px;
    padding: 14px 20px;
    line-height: 32px;
    background-color: #f5f5f5;
    .btn {
      position: absolute;
      right: 14px;
      top: 18px;
      display: inline-block;
      width: 30px;
      height: 30px;
      line-height: 30px;
      text-align: center;
      color: #757575;
      cursor: pointer;
      transition: all 0.2s;
      z-index: 10;
      border-radius: 15px;
      .iconfont {
        display: block;
        vertical-align: middle;
        font-size: 24px;
        width: 24px;
        height: 24px;
        line-height: 24px;
        font-weight: 200;
        transition: 0.5s;
        border-radius: 50%;
        &:hover {
          color: #fff;
          background-color: rgb(229, 57, 53);
        }
      }
    }
  }
  main {
    padding: 20px;
  }
  footer {
    height: 40px;
    padding: 20px 0;
    border-top: 1px solid #e0e0e0;
    text-align: center;
    background-color: #f5f5f5;
  }
}
</style>
